module V1
  class Upload < Grape::API
    # GET /v1/
    desc "excel"
    params do
        optional :file, type: Rack::Multipart::UploadedFile
    end
    post 'upload/file' do
      file = params[:file]
      path = params[:file][:tempfile].path
      spreadsheet = Roo::Spreadsheet.open(path) rescue Roo::Excel.new(path)
    end

    desc "img文件上传"
    params do
        optional :file, type: Rack::Multipart::UploadedFile
    end
    post 'upload/img' do
      # file = params[:file]
      # path = params[:file][:tempfile].path
      # spreadsheet = Roo::Spreadsheet.open(path) rescue Roo::Excel.new(path)
    end

  end
end
